﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>类目列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 新闻中心<span class="c-gray en">&gt;</span> 新闻管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form action="Goods_listDeal" method="get">
		<input type="hidden" name="${pagerItem.paramPageNum }" value="${pagerItem.pageNum }"/>
		<input type="hidden" name="${pagerItem.paramPageSize }" value="${pagerItem.pageSize }"/>
		<div class="text-c">名称：
			<input type="text" class="input-text" style="width: 250px" placeholder="输入名称" id="title" name="name" value="${name }"/>
			<button type="submit" class="btn btn-success radius" id="" name="">
				<i class="Hui-iconfont">&#xe665</i> 搜名称
			</button>
			<button type="button" class="btn btn-success radius" id="clearSearch" name="">
				<i class="Hui-iconfont">&#xe665</i> 清空
			</button>
		</div>
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
		<form action="Login" method="get">
			<button type="submit" class="btn btn-success radius" id="" name="">
				<i class="Hui-iconfont">&#xe665</i> 登录系统
			</button>
		</form>
		<hr>
		<form action="News_list" method="get">
			<button type="submit" class="btn btn-success radius" id="" name="">
				<i class="Hui-iconfont">&#xe665</i> 新闻
			</button>
		</form>
		</span>
		<span class="r">共有数据：<strong>${pagerItem.rowCount }</strong> 条</span> </div>
	<table id="datalist" class="table table-border table-bordered table-bg">
		<thead>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value="0"></th>
				<th width="80">ID</th>
				<th width="100">照片</th>
				<th width="100">名称</th>
				<th width="100">价格</th>
				<th width="100">描述</th>
				<th width="100">地址</th>
				<th width="100">类型</th>
				<th width="100">备注</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="item" items="${dataList}">
				<tr class="text-c">
					<td><input type="checkbox" value="${item.goodId}"></td>
					<td>${item.goodId}</td>
					<td>123</td>
					<td>${item.name }</td>
					<td>${item.price }</td>
					<td>${item.descibe }</td>
					<td>${item.address }</td>
					<td>${item.type }</td>
					<td>${item.beizhu }</td>
					<td>
						<a title="查看" href="javascript:;" class="ml-5" style="text-decoration: none"
							onclick="bean_detail(${item.goodId},'Goods_detail?id=${item.goodId}','','510')">
							<i class="Hui-iconfont">&#xe707;</i>
						</a>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<script>

	//修改url里的某个查询变量的值，如果不存在这个查询变量，则添加这个变量和值
	function changeUrlArg(url, arg, val) {
		var pattern = arg + '=([^&]*)';
		var replaceText = arg + '=' + val;
		return url= url.match(pattern) ? url.replace(eval('/(' + arg
				+ '=)([^&]*)/gi'), replaceText) : (url.match('[\?]') ? url
				+ '&' + replaceText : url + '?' + replaceText);
	}
	
	
</script>

<div class="paging">

	<div class="aleft" style="display: inline-block; float: left;">
		<span>共${pagerItem.rowCount }行，</span> </span><span><select
			onchange="location.href=changeUrlArg(changeUrlArg(location.href,'${pagerItem.paramPageSize }', this.options[this.options.selectedIndex].value),'${pagerItem.paramPageNum }', '1');">

				<c:forEach var="i" begin="1" end="100" step="1">

					<option value="${i }" ${pagerItem.pageSize==i?"selected":""}>${i }</option>
				</c:forEach>

		</select>行/页</span>
	</div>
	<div class="aright" style="display: inline-block; float: right;">


		<c:set value="${pagerItem.pageNum == 1}" var="isFisrtPage"
			scope="request" />
		<c:set value="${pagerItem.pageNum == pagerItem.pageCount}"
			var="isLastPage" scope="request" />


		<c:choose>
			<c:when test="${isFisrtPage}">
				&nbsp;<span style="color:#ccc">首页</span>
				&nbsp;<span style="color:#ccc">上一页</span>
			</c:when>
			<c:otherwise>
				&nbsp;<span><a href="${pagerItem.firstPageUrl }">首页</a></span>
				&nbsp;<span><a href="${pagerItem.prevPageUrl }">上一页</a></span>
			</c:otherwise>
		</c:choose>

		<c:choose>
			<c:when test="${isLastPage}">
				&nbsp;<span style="color:#ccc">下一页 </span>
				&nbsp;<span style="color:#ccc">尾页</span>
			</c:when>
			<c:otherwise>
				&nbsp;<span><a href="${pagerItem.nextPageUrl }">下一页</a></span>
				&nbsp;<span><a href="${pagerItem.lastPageUrl }">尾页</a></span>
			</c:otherwise>
		</c:choose>


		<span>&nbsp;&nbsp;&nbsp;&nbsp;跳到第 <select
			onchange="location.href=changeUrlArg(location.href,'${pagerItem.paramPageNum }', this.options[this.options.selectedIndex].value);">

				<c:forEach var="i" begin="1" end="${pagerItem.pageCount }">

					<option value="${i }"${pagerItem.pageNum==i?"selected":""}>${i }</option>
				</c:forEach>

		</select>页 /共${pagerItem.pageCount }页
	</div>
</div>

	
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
 $(function(){
	 $("#clearSearch").click(function(){
		 location.href = "Goods_list";
	 });
     
 });
 function bean_insert(title,url,w,h){
	 layer_show(title,url,w,h);
 }
 function bean_detail(title,url,w,h){
	 layer_show(title,url,w,h);
 }
 function bean_update(title,url,w,h){
	 layer_show(title,url,w,h);
 }
 
 function bean_delete(obj,id) {
	 layer.confirm('确认要删除吗？',function(index){
		 $.ajax({
			 type:'POST',
			 url:"Goods_deleteDeal",
			 data:{"id":id},
			 success:function(data){
				 if(data=="ok") {
					 $(obj).parents("tr").remove();
					 layer.msg('已删除！',{icon:1,time:2000});
				 }else {
					 layer.msg('删除失败！',{icon:1,time:2000});
				 }
			 },
			 error:function(data) {
				 layer.msg('Error！',{icon:1,time:2000});
				 console.log(data.msg);
			 },
		 });
	 });
 }
 
 function bean_batch_delete() {
	 layer.confirm('确认要删除选中数据吗？',function(index){
		 var num=0;
		 var total=0;
		 var obj=null;
		 $("#datalist input[type=checkbox]:checked").each(function(){
			 obj=this;
			 id=$(this).val();
			 if(id!=null && id!="0") {
				 total++;
				 $.ajax({
					 type:'POST',
					 url:"Goods_deleteDeal",
					 async:false,
					 data:{"id":id},
					 success:function(data){
						 if(data=="ok"){
							 $(obj).parents("tr").remove();
							 num++;
						 }
					 },
					 error:function(data){
						 
					 },
				 });
			 }
		 });
		 layer.msg('要删除'+total+'行记录, 成功删除'+num+'行记录。',{icon:1,time:3000});
	 });
 }
</script>
</body>
</html>